Promise.all = async promises => {
    let re = []
    try{
        for await (const value of promises)re.push(value)
    }catch(e){
        return Promise.reject(e)
    }
    return re;
}

let promises = [
    new Promise(resolve=>setTimeout(_=>resolve(1000), 1000)),
    new Promise(resolve=>setTimeout(_=>resolve(1000), 1000)),
    new Promise(resolve=>setTimeout(_=>resolve(1000), 1000)),
    new Promise(resolve=>setTimeout(_=>resolve(1000), 1000)),
    new Promise(resolve=>setTimeout(_=>resolve(4000), 4000)),
    new Promise(resolve=>setTimeout(_=>resolve(1000), 1000)),
    new Promise(resolve=>setTimeout(_=>resolve(1000), 1000)),
    new Promise(resolve=>setTimeout(_=>resolve(1000), 1000)),
    new Promise(resolve=>setTimeout(_=>resolve(1000), 1000)),
]

console.log(
    await Promise.all(promises)
)
